<?php

namespace backend\controllers;

use Yii;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use yii\web\ForbiddenHttpException;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\base\Object;
use yii\base\Response;
use yii\widgets\ActiveForm;
use yii\web\UploadedFile;
use backend\models\LogPayVipSearch;
/**
 * vip支付订单控制器
 * @author suiyue
 *
 */
class PayVipController extends BaseController
{
	/**
	 * (non-PHPdoc)行为
	 * @see \yii\base\Component::behaviors()
	 */
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['post'],
                ],
            ],
        ];
    }
    /**
     * (non-PHPdoc)前置函数
     * @see \yii\web\Controller::beforeAction()
     */
    public function beforeAction($action)
    {
    	$action = Yii::$app->controller->action->id;
    	$controller = Yii::$app->controller->id;
    	$action_list = array(
    			'index',
    			'update',
    			'view',
    			'create',
    	);
    	 $access=$this->checkAccess($action_list,$action);//判断操作的action是否在actionlist里面
    	 $this->beforeOp('pay-vip', $access);//身份识别 权限验证  action验证
    	 return true;
    }
	/**
	 *  列表
	 */
    public function actionIndex()
    {
    	$searchModel = new LogPayVipSearch();
    	$model_return= $searchModel->search(Yii::$app->request->queryParams);
    	$dataProvider =$model_return["dataprovider"];
    	$rmb_count=$model_return["count"];
    	return $this->render('index', [
    			'searchModel' => $searchModel,
    			'dataProvider' => $dataProvider,
    	    'rmb_count'=>$rmb_count
    	]);
    }
     
    /**
     * 查找单个
     * @param   $id
     * @throws NotFoundHttpException
     */
    protected function findModel($id)
    {
        if (($model = Brand::findOne($id)) !== null) {
        	$model = Brand::find()->where('id='.$id)->one();
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
   
    
}
